package com.example.mindadinner.net.request;

import java.util.HashMap;
import java.util.Map;

import com.example.mindadinner.net.NetRequest;
import com.example.mindadinner.net.NetResponse;
import com.example.mindadinner.net.response.BookGetResponse;
import com.example.mindadinner.net.response.PostResponse;


public enum NetServiceMeta {
	POST("PostRequest/PostRequest",PostRequest.class,PostResponse.class),
	BOOKGET("BookGetRequest/BookGetResponse",BookGetRequest.class,BookGetResponse.class);
	;

	private final String uri;
	private final Class<? extends NetRequest> requestType;
	private final Class<? extends NetResponse> responseType;
	
	
	private static final Map<Class<? extends NetRequest>,NetServiceMeta> metas;
	static {
		metas = new HashMap<Class<? extends NetRequest>, NetServiceMeta>();
		for (final NetServiceMeta meta: values()) {
			metas.put(meta.requestType,meta);
		}		
		
	}
	
	
	public static NetServiceMeta getNetServiceMeta(Class<? extends NetRequest> requestType){
		return metas.get(requestType);
	}
	
	public Class<? extends NetRequest> getRequestType() {
		return requestType;
	}

	public Class<? extends NetResponse> getResponseType() {
		return responseType;
	}

	public String getUri() {
		return uri;
	}

	private NetServiceMeta(String uri, Class<? extends NetRequest> requestType,
			Class<? extends NetResponse> responseType) {
		this.uri = uri;
		this.requestType = requestType;
		this.responseType = responseType;
	}

}
